﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Catering.Catering_Page.system
{
    public partial class Sex : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void but_SexInfo_Add_Click(object sender, EventArgs e)
        {
            Catering_Model.Sex sex = new Catering_Model.Sex();

            Catering_Rules.Sex rsex = new Catering_Rules.Sex();
            sex.id = rsex.GetMaxId();
            sex.SexName = this.txt_Sex_Name.Text.Trim();
            sex.temp1 = this.txt_Sex_Back.Text.Trim();
            try
            {
                rsex.Add(sex);
                this.Panel_Add.Visible = false;
                Response.Redirect("Sex.aspx");
            }
            catch
            {
                View_Operaction_Common.Show(this, "添加失败");
            }
        }

        protected void but_SexInfo_Add_Clear(object sender, EventArgs e)
        {
            Response.Redirect("Sex.aspx");
        }

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("New"))
            {
                this.Panel_Add.Visible = true;
            }
        }
    }
}